<link href="__STATIC__/admin/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<div class="row">
    <div class="col-md-12">
        <div class="box box-primary">
            <div class="box-header">
                <h3 class="box-title">编辑分类</h3>
            </div>
            <form id="addCategoryForm">
                <div class="box-body">
                    <div class="form-group">
                        <label for="cname">分类名称</label>
                        <input type="text" class="form-control" value="{$category['cname']}" name="cname" id="cname" placeholder="请输入分类名称">

                    </div>

                </div>

                <div class="box-footer text-center">
                    <input type="hidden"  name="cid"  value="{$category['cid']}">
                    <button type="button" onclick="submitData('addCategoryForm');" class="btn btn-primary">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="__STATIC__/admin/js/jquery.min.js"></script>
<script>
    function  submitData(formid){
        var data =$('#'+formid).serialize();//将表单数据序列化
        $.ajax({
            url:"{:url('admin/Category/editHandle')}",
            data:data,
            type:'POST',
            datatype:'json',
            success:function(d){
                if(d.code==1){
                    location.href="{:url('admin/Category/categoryList')}";
                }else{
                    alert('修改失败');
                }

            }
        })
    }
</script>